<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- .wrap>button{新增}+ul.list>li*6{$$} -->
    <div class="wrap">
        <button class="btn">克隆</button>
        <ul class="list">
            <li>01</li>
            <li>02</li>
            <li class="mid">03</li>
            <li>04</li>
            <li>05</li>
            <li>06</li>
        </ul>
    </div>
</body>
<script>
    var btn1 = document.getElementsByClassName("btn")[0];
    var btn2 = document.getElementsByClassName("btn")[1];
    var wrap = document.getElementsByClassName("wrap")[0];
    var list = document.getElementsByClassName("list")[0];
    var mid = document.getElementsByClassName("mid")[0];

    // 元素克隆 
    // Element.clone(bool)     => 返回被克隆的元素
    // bool
    // false(默认):  浅克隆 => 只克隆元素本身 及其相关属性,至于子内容不克隆
    // true :  深克隆 => 既克隆元素本身 及其相关属性,又克隆其子内容


    // 点击按钮 删新增一个li 替换mid
    btn1.onclick = function () {
        var cloneEle = list.cloneNode(true);
        wrap.append(cloneEle);
    }




  




</script>

</html>